package com.jlpay.openapi.demo.cashier;

import com.jlpay.open.jlpay.sdk.java.model.cashier.request.OrderQueryRequest;
import com.jlpay.open.jlpay.sdk.java.model.cashier.response.OrderQueryResponse;
import com.jlpay.open.jlpay.sdk.java.utils.json.JsonUtils;
import com.jlpay.openapi.demo.JlpayOpenApiService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 *
 * @author dengwenning
 * @since 2024/9/24
 **/
public class OrderQueryService {
    private static final Logger LOGGER = LoggerFactory.getLogger(OrderQueryService.class);

    public static void main(String[] args) {
        OrderQueryRequest orderQueryRequest = buildOrderQueryRequest();
        OrderQueryResponse orderQueryResponse = JlpayOpenApiService.openMerchService()
                .post(orderQueryRequest, OrderQueryResponse.class);
        LOGGER.info("收银托管订单查询响应:{}", JsonUtils.toString(orderQueryResponse));
    }

    private static OrderQueryRequest buildOrderQueryRequest() {
        OrderQueryRequest orderQueryRequest = new OrderQueryRequest();

        orderQueryRequest.setMerchNo("849584358120018");
        orderQueryRequest.setOutTradeNo("ld201911023465529");

        return orderQueryRequest;
    }
}
